module Manage::MainHelper
  def image_date_tag(date, options={})
    return if date.blank?
    
    options.symbolize_keys!
    style = options.delete(:style)
    
    return "<div class='date_block' style='#{style}'>
			<div class='date_block_day' style='background: url(/images/manage/dates/d#{date.day.to_s}.png);'>&nbsp;</div>
			<div class='date_block_month' style='background: url(/images/manage/dates/m#{date.month.to_s}.png);'>&nbsp;</div>
			<div class='date_block_year' style='background: url(/images/manage/dates/y#{date.year.to_s}.png);'>&nbsp;</div>
		</div>"
  end
    
  def block_form(options={}, &block)
    width = options[:width]
    
  	concat(tag('div', {:class=>"block dark", :style=>"margin: 10px 0px;width:#{width}px;"}, true))
  	concat('<b class="rd5"></b><b class="rd4"></b><b class="rd3"></b><b class="rd2"></b><b class="rd1"></b>')
  	concat(tag('div', {:class=>'content'}, true))
  	yield
  	concat("</div>")
  	concat('<b class="rd1"></b><b class="rd2"></b><b class="rd3"></b><b class="rd4"></b><b class="rd5"></b>')
  	concat("</div>")
  end
  
  def add_photos_item_link(name)
    link_to_function name do |page|
      page.insert_html :bottom, :photo_items, :partial => 'manage/photos/photo_item', :object => Photo.new
    end
  end
end
